import { createApp } from 'vue'
import '@/styles/skin.scss'
import App from '@/App.vue'
import router from '@/router'
import { createPinia } from "pinia";
import VueLazyload from 'vue-lazyload';
const pinia = createPinia();
import './vant.js'
import hasRoleNone from '../utils/hasRole.js';
// import hasRoleToast from './directives/hasRole';
import { Lazyload } from 'vant';
import Components from '@/components';
import ViewsComponents from '@/views/components';
import 'lib-flexible'

pinia.use(({ store }) => {
	if (store.$id=='cart') {
		const initCartState = JSON.parse(JSON.stringify(store.$state));
		store.$reset = () => {
			store.$patch(initCartState);
		};
	}
});

const app = createApp(App).use(router).use(pinia).use(Components).use(ViewsComponents).use(Lazyload).use(VueLazyload);
app.directive('has-role', hasRoleNone);
app.mount('#app')